
def need_login(func):
    def dec(*args):
        wb = args[0]
        if wb.user_id is None:
            wb.login_weibo()
        result = func(*args)
        return result
    return dec
